<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <div id="app">
            <table border="3" style="margin: auto;">
                <thead>
                    <tr>
                        <th>欢迎光临_vue开发的收银系统-水果店</th>
                </thead>
                <tbody>
                    <tr align="center">
                        <td>苹果10￥/斤，折扣<8折></td>
                    </tr>
                    <tr align="center">
                        <td>请输入你要购买的斤数
                            <input type="text" v-model="much">
                        </td>
                    </tr>
                    <tr align="center" @click="jiaojiao">
                        <td><button>结账买单~</button></td>
                    </tr>
                    <tr align="center">
                        <td>结账单:总价:{{ num }}￥元 折扣价:{{ discount }}￥元 省了:{{ difference }}￥元</td>
                    </tr>
                </tbody>
            </table>
        </div>
        
        <script src="./lib/vue.js"></script>
        <script>
          new Vue({
            el: '#app',
            data:{
                much:'',
                num:0,
                discount:0,
                difference:0

            },
            methods:{
                jiaojiao(){
                   this.num = this.much * 10
                   this.discount = this.much * 8
                   this.difference = this.num - this.discount
                   console.log(num,discount,difference)
                }
            }
          })
        </script>
      </div>
</body>
</html>